package com.zp.self.module.level_3_框架_工具.I_spring.AOP.Proxy实现.我的实现;

import org.junit.Test;

import java.lang.reflect.Proxy;

/**
 * @author By ZengPeng
 * @Description
 * @date in  2021/3/24 21:09
 * @Modified By
 */
public class 创建代理类 {
    @Test
    public void create(){
        Chinese chinese = new Chinese();
        Person chineseProxy = (Person)Proxy.newProxyInstance(
                Chinese.class.getClassLoader(), //类加载器
                Chinese.class.getInterfaces(),  //获得被代理对象的所有接口
                new InvocationHandlerImpl(chinese));//InvocationHandler 对象
        chineseProxy.eat("大肉");
        Class<? extends Person> aClass = chineseProxy.getClass();
    }
}
